<!--_meta 作为公共模版分离出去-->
<!DOCTYPE HTML>
<html>
<head>
    {include file="public/meta"}
    <!--/meta 作为公共模版分离出去-->
    <!-- 最新版本的 Bootstrap 核心 CSS 文件 -->
    <title>我的书籍</title>
    <meta name="keywords" content="">
    <meta name="description" content="">
    <link rel="stylesheet" href="/static/author/page.css">
</head>
<body>
<div class="wap-container">
    <nav class="breadcrumb" style="background-color:#fff;padding: 0 24px">
        首页
        <span class="c-gray en">/</span>
        定时章节
        <span class="c-gray en">/</span>
        章节列表
        <a class="btn btn-success radius f-r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a>
    </nav>

    <article class="Hui-admin-content clearfix">
        <div class="panel mt-20">
            <div class="panel-body">
                <div class="clearfix">
                    <span class="f-r">共有数据：<strong>{$total}</strong> 条</span>
                </div>
                <div class="mt-20 clearfix">
                    <table class="table table-border table-bordered table-bg table-hover table-sort">
                        <tr>
                            <th scope="col" colspan="9">定时列表</th>
                        </tr>
                        <tr class="text-c">
                            <th width="150">章节名称</th>
                            <th width="130">书籍名称</th>
                            <th width="70">执行时间</th>
                            <!--<th width="100">操作</th>-->
                        </tr>
                        <tbody>
                        {volist name="data" id="vo"}
                        <tr class="text-c">
                            <td>{$vo.chapter_name}</td>
                            <td>{$vo.name}</td>
                            <td>{$vo.time|date="Y-m-d H:i:s"}</td>
                        </tr>
                        {/volist}
                        </tbody>
                    </table>
                    <div class="paginate">{$data->render()|raw}</div>
                </div>
            </div>
        </div>
    </article>
</div>

<!--_footer 作为公共模版分离出去-->
{include file="public/footer"}
<!--/_footer /作为公共模版分离出去-->

<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="/static/author/lib/datatables/1.10.15/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="/static/author/lib/laypage/1.2/laypage.js"></script>
<script type="text/javascript" src="/static/author/static/business/js/main.js"></script>
<script type="text/javascript">
    $(function(){
        runDatetimePicker();
        // 全选 页面调用
        $(".table").HuicheckAll(
            {
                checkboxAll: 'thead input[type="checkbox"]',
                checkbox: 'tbody input[type="checkbox"]'
            },
            function(checkedInfo) {
                console.log(checkedInfo);
            }
        )
    });
    //添加
    function admin_add(title,url){
        var index = layer.open({
            type: 2,
            title: title,
            content: url,
        });
        layer.full(index);
    }
    function book_edit(title,url){
        var index = layer.open({
            type: 2,
            title: title,
            content: url,
        });
        layer.full(index);
    }
    /*用户-停用*/
    function book_stop(obj,id){
        layer.confirm('设置为免费章节',function(index){
            $.post("/author/my_book/noCharge",{id:id},function(data){
                if(data.state === 200){
                    $(obj).parents("tr").find(".td-manage").prepend('<a style="text-decoration:none" onClick="book_start(this,'+id+')" href="javascript:;" title="">no</a>');
                    $(obj).parents("tr").find(".td-status").html('<span class="label label-defaunt radius">免费</span>');
                    $(obj).remove();
                    layer.msg('免费!',{icon: 6,time:1000});
                }else{
                    layer.msg('更改失败',{icon: 5,time:1000});
                }
            });
        });
    }

    /*用户-启用*/
    function book_start(obj,id){
        layer.confirm('设置为收费章节',function(index){
            $.post("/author/my_book/charge",{id:id},function(data){
                if(data.state === 200){
                    $(obj).parents("tr").find(".td-manage").prepend('<a style="text-decoration:none" onClick="book_stop(this,'+id+')" href="javascript:;" title="">no</a>');
                    $(obj).parents("tr").find(".td-status").html('<span class="label label-success radius">收费</span>');
                    $(obj).remove();
                    layer.msg('完成',{icon: 6,time:1000});
                }else{
                    layer.msg('更改失败',{icon: 5,time:1000});
                }
            });

        });
    }
    function book_del(obj,id){
        layer.confirm('确认要删除吗？',function(index){
            var url = "/author/my_book/delete";
            $.post(url,{id:id},function(data){
                if(data.state === 200){
                    $(obj).parents("tr").remove();
                    layer.msg('已删除!',{icon:1,time:1000});
                }else{
                    layer.msg('删除失败!',{icon:2,time:1000});
                }
            });
        });
    }
    $.get("/index/index/crontab",function(){});
</script>
<!--/请在上方写此页面业务相关的脚本-->
</body>
</html>
